using McMaster.Extensions.CommandLineUtils;

namespace Awesome.MyCommand;

/// <summary>
/// 子命令.镜像管理
/// </summary>
[Command("image", Description = "管理镜像")]
public class Images {
  public Images (CommandLineApplication app) {
    app.Description = "这是Docker镜像操作命令";
  }

  [Option(CommandOptionType.NoValue, ShortName = "l", Description = "查看镜像")]
  public bool List { get; }

  [Option("-r|--remove", ValueName = "image_name|image_id", Description = "移除镜像")]
  public string Remove { get; }

  private int OnExecute (CommandLineApplication app, IConsole console) {
    // Console.WriteLine("-------"+app.Options.Count);
    // if (app.Arguments.Count == 0)
    // {
    //     app.ShowHelp();
    //     return 1;
    // }
    console.WriteLine($"List: {List}");
    console.WriteLine($"Remove: {Remove}");
    return 0;
  }


  //
  // [Command("ls", Description = "List images", UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.StopParsingAndCollect)]
  // private class List
  // {
  //     [Option(Description = "显示所有容器)")]
  //     public bool All { get; }
  //
  //     private IReadOnlyList<string> RemainingArguments { get; }
  //
  //     private void OnExecute(IConsole console)
  //     {
  //         console.WriteLine(string.Join("\n",
  //             "IMAGES",
  //             "--------------------",
  //             "microsoft/dotnet:2.0"));
  //     }
  // }
}

